#include <iostream>
#include <vector>
using namespace std;

void reverse(vector<int>& a, int start, int end) {
    while (start < end) {
        swap(a[start], a[end]);
        start++;
        end--;
    }
}

void leftRotate(vector<int>& a, int n, int m) {
    m = m % n; // 处理m大于n的情况
    reverse(a, 0, n - 1);
    reverse(a, 0, n - 1 - m);
    reverse(a, n - m, n - 1);
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    leftRotate(a, n, m);
    
    for (int i = 0; i < n; i++) {
        cout << a[i];
        if (i < n - 1) cout << " ";
    }
    cout << endl;
    return 0;
}
